package com.ikas.ai.server.module.appraise.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ikas.ai.server.module.appraise.model.AppraiseResult;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 评价结果
 *
 * @author hubowei
 * @email hu.bowei@ikasinfo.com
 * @date 2023-01-30 15:01:30
 */
@Mapper
public interface AppraiseResultDAO extends BaseMapper<AppraiseResult> {

    AppraiseResult selectOneByFlowInstanceId(@Param("flowInstanceId") Long flowInstanceId);

    List<AppraiseResult> overViewList();

    List<AppraiseResult> getAppraiseResultByMachineNo(@Param("machineNo") String machineNo, @Param("type") Integer type);

    @Select("SELECT SUBSTRING_INDEX(group_concat( id ORDER BY update_time DESC ), ',', 1 ) as ids FROM t_appraise_result WHERE type = 1 GROUP BY system_no ")
    List<Long> overViewIds();
}
